﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BaiTu.QueueService;
using BaiTu.IQueueService;
using BaiTu.IOCServices;
using BaiTu.QueueEntity;
using System.Collections.Generic;

namespace BaiTu.QueueService.Testing
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {

            try
            {

                IOCServices.EngineContext.Initialize(false);
                IQueue queue = EngineContext.Current.Resolve<IQueue>();
                ///检查队列是否存在
                queue.CreateIfNotExists<DTO1>();

                string messageID = "";
                DateTime from = DateTime.Now;
                int max = 5000;
                List<string> listID = new List<string>();
                DTO1 m11 = new DTO1();
                for (var i = 0; i < max; i++)
                {
                    DTO1 o = new DTO1();
                    o.p1 = "1";
                    o.p2 = i.ToString() + @"缺点是什么函数嵌套后，理解起来比较吃力
函数嵌套后，一行函数调用写成了很多行，很容易因为逗号、括号等造成语法错误
jQuery和liger在应用代码中强耦合，要是以后要更换UI框架，需要进行地毯式搜索.";

                    Message<DTO1> msg = new Message<DTO1>();
                    msg.Body = o;
                    listID.Add(queue.SendRequestToWorker<DTO1>(msg));

                    var messs = queue.GetRequestFromClient<DTO1>();
                    m11 = messs.Body;
                }



            }
            catch (Exception ex)
            {

            }
        }
    }
    public class DTO1
    {
        public string p1 { get; set; }
        public string p2 { get; set; }
    }
}
